<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 300px;
            height: 300px;
            background: red;
            border-top: 1px solid transparent;
            box-sizing: border-box;
        }

        .child {
            width: 100px;
            height: 100px;
            background: yellow;
            margin-left: 100px;
            margin-top: 100px;
        }
    </style>
</head>

<body>
    <!-- 1内外边距无法自动计算-->
    <!--2如果子元素的上方没有任何内容,那么上边距会算在父元素身上-->
    <div class="box">
        <div class="child"></div>
    </div>
</body>

</html>